import request from '@/utils/request'

// 查询教师列表
export function listUnit(query) {
  return request({
    url: '/system/unit/list',
    method: 'get',
    params: query
  })
}

// 查询教师详细
export function getUnit(unitId) {
  return request({
    url: '/system/unit/' + unitId,
    method: 'get'
  })
}

// 新增教师
export function addUnit(data) {
  return request({
    url: '/system/unit',
    method: 'post',
    data: data
  })
}

// 修改教师
export function updateUnit(data) {
  return request({
    url: '/system/unit',
    method: 'put',
    data: data
  })
}

// 绑定单词
export function bindWord(unitId, wordIds) {
  return request({
    url: '/system/unit/' + unitId + '/bind-word/' + wordIds,
    method: 'post'
  })
}

// 解绑班级
export function unbindWord(unitId, wordId) {
  return request({
    url: '/system/unit/' + unitId + '/unbind-word/' + wordId,
    method: 'delete'
  })
}

// 根据单元删除单词
export function deleteWordsByUnitId(data) {
  return request({
    url: '/system/unit/deleteWordsByUnitId',
    method: 'delete',
    params: data
  })
}

// 查询单元下拉树结构
export function courseTreeSelect() {
  return request({
    url: '/system/unit/courseTree',
    method: 'get'
  })
}

// 删除单元
export function delUnit(unitId) {
  return request({
    url: '/course/unit/' + unitId,
    method: 'delete'
  })
}

// 导出单元
export function exportUnit(query) {
  return request({
    url: '/course/unit/export',
    method: 'get',
    params: query
  })
}
